package com.cuit.zuke.system.controller;

import com.cuit.zuke.common.annotation.ControllerEndpoint;
import com.cuit.zuke.common.util.Result;
import com.cuit.zuke.system.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @program: zuke
 * @description: 系统日志
 * @author: KamTang
 * @create: 2022-04-15 14:52
 **/
@RestController
@RequestMapping("/sys/log")
public class SysLogController {

    @Autowired
    private SysLogService logService;

    /**
     * 日志列表
     * @param params
     * @return
     */
    @GetMapping("/list")
    public Result list (@RequestParam Map<String, Object> params) {
        return Result.ok().put("logPage", logService.findLogList(params));
    }

    /**
     * 删除日志
     * @param ids
     * @return
     */
    @ControllerEndpoint(exceptionMessage = "操作日志删除失败", operation = "删除操作日志")
    @PostMapping("/delete")
    public Result deleteReport (@RequestBody Long[] ids) {
        logService.deleteBatch(ids);
        return Result.ok();
    }
}
